package com.smart.community.work.dto;

import java.time.LocalDateTime;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.smart.community.commons.base.BaseDTO;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 消息通知DTO
 *
 * @author Wu.Liang
 * @since 2025-01-30
 * @version 1.0.0
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "消息通知DTO")
public class NotificationDTO extends BaseDTO {
    /**
	 * @author Wu.Liang
	 * @date 2025年9月14日
	 */
	private static final long serialVersionUID = -3020645667493881083L;

	@Schema(description = "发送人ID", example = "1")
    @NotNull(message = "发送人ID不能为空")
    private Long senderId;

    @Schema(description = "接收人ID", example = "2")
    @NotNull(message = "接收人ID不能为空")
    private Long receiverId;

    @Schema(description = "物业公司ID", example = "1")
    @NotNull(message = "物业公司ID不能为空")
    private Long propertyCompanyId;

    @Schema(description = "消息标题", example = "请假申请审批通知")
    @NotBlank(message = "消息标题不能为空")
    @Size(max = 100, message = "消息标题不能超过100个字符")
    private String title;

    @Schema(description = "消息内容", example = "您有一个请假申请需要审批")
    @NotBlank(message = "消息内容不能为空")
    @Size(max = 2000, message = "消息内容不能超过2000个字符")
    private String content;

    @Schema(description = "消息类型：0-系统通知，1-任务通知，2-审批通知，3-普通消息", example = "2")
    @NotNull(message = "消息类型不能为空")
    @Min(value = 0, message = "消息类型必须在0-3之间")
    @Max(value = 3, message = "消息类型必须在0-3之间")
    private Integer type;

    @Schema(description = "阅读状态：0-未读，1-已读", example = "0")
    private Integer status = 0;

    @Schema(description = "关联业务ID（如工单ID，请假ID等）", example = "123")
    private Long relatedId;

    @Schema(description = "关联业务类型", example = "LEAVE")
    @Size(max = 50, message = "关联业务类型不能超过50个字符")
    private String relatedType;

    @Schema(description = "是否紧急", example = "false")
    private Boolean urgent = false;

    @Schema(description = "是否置顶", example = "false")
    private Boolean pinned = false;

    @Schema(description = "优先级：0-低，1-普通，2-高，3-紧急", example = "1")
    @Min(value = 0, message = "优先级必须在0-3之间")
    @Max(value = 3, message = "优先级必须在0-3之间")
    private Integer priority = 1;

    @Schema(description = "过期时间", example = "2025-02-28 23:59:59")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime expireTime;

    // 查询条件字段
    @Schema(description = "查询开始时间", example = "2025-01-01")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String queryStartDate;

    @Schema(description = "查询结束时间", example = "2025-01-31")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String queryEndDate;

    @Schema(description = "发送人姓名", example = "张三")
    private String senderName;

    @Schema(description = "接收人姓名", example = "李四")
    private String receiverName;

    @Schema(description = "消息类型名称", example = "审批通知")
    private String typeName;

    @Schema(description = "是否批量发送", example = "false")
    private Boolean batchSend = false;

    @Schema(description = "批量接收人ID列表")
    private java.util.List<Long> receiverIds;
}
